import request from '@/utils/request';

// 获取某个评论的回复
export const getCommentReply = query => {
	return request({
		url: '/admin/user/getCommentReply',
		method: 'post',
		params: query,
		headers: {
			'Content-Type': 'application/x-www-form-urlencoded'
		}
	});
};

//回复某个评论
export const comment = query => {
	return request({
		url: '/admin/user/comment',
		method: 'post',
		params: query,
		headers: {
			'Content-Type': 'application/x-www-form-urlencoded'
		}
	});
};

//根据关键字获取会员权益
export const vipRightsPageQuery = query => {
	return request({
		url: '/admin/vipRights/pageQuery',
		method: 'get',
		params: query,
		headers: {
			'Content-Type': 'application/x-www-form-urlencoded'
		}
	});
};

//获取所有会员权益
export const vipRightsGetAll = query => {
	return request({
		url: '/admin/vipRights/getAll',
		method: 'get',
		params: query,
		headers: {
			'Content-Type': 'application/x-www-form-urlencoded'
		}
	});
};

//保存、更新、启用会员权益
export const vipRightsUpdate = query => {
	return request({
		url: '/admin/vipRights/update',
		method: 'post',
		data: query
	});
};

//删除会员权益
export const vipRightsDel = query => {
	return request({
		url: '/admin/vipRights/delete',
		method: 'post',
		params: query,
		headers: {
			'Content-Type': 'application/x-www-form-urlencoded'
		}
	});
};

//获取小程序
export const getMiniApp = query => {
	return request({
		url: '/admin/miniApp/getMiniApp',
		method: 'post',
		params: query,
		headers: {
			'Content-Type': 'application/x-www-form-urlencoded'
		}
	});
};

//新增或者更新小程序
export const miniAppAdd = query => {
	return request({
		url: '/admin/miniApp/add',
		method: 'post',
		data: query
	});
};

//新增会员等级
export const addVipPackage = query => {
	return request({
		url: '/admin/setting/addVipPackage',
		method: 'post',
		data: query
	});
};

//分页获取会员等级列表
export const getVipPackage = query => {
	return request({
		url: '/admin/setting/getVipPackage',
		method: 'get',
		params: query
	});
};

// 删除会员等级
export const delVipPackage = query => {
	return request({
		url: '/admin/setting/delVipPackage',
		method: 'get',
		params: query
	});
};

// 分页查询用户错误的试题
export const pageIncorrect = query => {
	return request({
		url: '/admin/user/pageIncorrect',
		method: 'get',
		params: query
	});
};

// 分页查询用户收藏的试题
export const pageFavorite = query => {
	return request({
		url: '/admin/user/pageFavorite',
		method: 'get',
		params: query
	});
};

//获取配置信息
export const getByKey = query => {
	return request({
		url: '/admin/config/getByKey',
		method: 'get',
		params: query,
		headers: {
			'Content-Type': 'application/x-www-form-urlencoded'
		}
	});
};

//添加或者更新配置信息
export const configAdd = query => {
	return request({
		url: '/admin/config/add',
		method: 'post',
		data: query
	});
};

//询用户详情的收益信息
export const getUserReward = query => {
	return request({
		url: '/admin/user/getUserReward',
		method: 'get',
		params: query,
		headers: {
			'Content-Type': 'application/x-www-form-urlencoded'
		}
	});
};
